﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebPropertiesEditor.aspx.cs"
    Inherits="Trentacular.SharePoint.Features.Web.UI.WebPropertiesEditor, Trentacular.SharePoint.Features.Web.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=544f3330e04bd2bc" %>

<%@ Import Namespace="Microsoft.SharePoint" %>

<%@ Register TagPrefix="sp" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="t" Namespace="Trentacular.SharePoint.Features.Web.UI.WebControls" Assembly="Trentacular.SharePoint.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=544f3330e04bd2bc" %>

<%@ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="InputFormControl" src="~/_controltemplates/InputFormControl.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>

<asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
	<sp:EncodedLiteral runat="server" text="<%$Resources:wss,multipages_homelink_text%>" EncodeMethod="HtmlEncode" /> -
	<sp:ProjectProperty Property="Title" runat="server" /> -
	Manage Site Properties
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageImage" runat="server"><IMG SRC="/_layouts/images/blank.gif" width="1" height="1" alt=""></asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
    Manage Site Properties
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleBreadcrumb" runat="server"/>
<asp:Content ContentPlaceHolderId="PlaceHolderTitleAreaClass" runat="server">
<style type="text/css">
td.ms-titleareaframe, .ms-pagetitleareaframe {
	height: 10px;
}
div.ms-titleareaframe {
	height: 100%;
}
.ms-pagetitleareaframe table {
	background: none;
	height: 10px;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
	<META Name="CollaborationServer" Content="SharePoint Team Web Site">
	<script type="text/javascript">
	var navBarHelpOverrideKey = "wssmain";
	</script>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderSearchArea" runat="server">
	<sp:DelegateControl runat="server" ControlId="SmallSearchInputBox" />
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server" />
<asp:Content ContentPlaceHolderId="PlaceHolderBodyAreaClass" runat="server">
<style type="text/css">
.ms-bodyareaframe {
	padding: 0px;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">

    <table border="0" cellspacing="0" cellpadding="0" width="100%">
	    <wssuc:InputFormSection
		     Title="Add New Property"
		     runat="server">
		     <Template_Description>
    			 It is preferred to use all lowercase key names to seemlessly support the retrofitted AllProperties Hashtable.
    			 If uppercase letters are used, the property will be added separately to both the the classic Properties PropertyBag (which is
    			 not case sensitive) and the newer AllProperties Hashtable in order to support case sensitivity.
		     </Template_Description>
		     <Template_InputFormControls>
		        <wssuc:InputFormControl runat="server" LabelText="Key">
				    <Template_Control>
					    <sp:InputFormTextBox ID="txtKey" runat="server" Title="Key"
					        class="ms-long" /><sp:InputFormRequiredFieldValidator runat="server"
					        ControlToValidate="txtKey"
					        ValidationGroup="AddProperty"
						    ErrorMessage="Key is required" />
				    </Template_Control>
			    </wssuc:InputFormControl>
		        <wssuc:InputFormControl runat="server" LabelText="Value">
				    <Template_Control>
					    <sp:InputFormTextBox ID="txtValue" runat="server" Title="Value"
					        class="ms-long" /><sp:InputFormRequiredFieldValidator runat="server"
					        ControlToValidate="txtValue"
						    ValidationGroup="AddProperty"
						    ErrorMessage="Value is required" />
				    </Template_Control>
			    </wssuc:InputFormControl>
		     </Template_InputFormControls>
	     </wssuc:InputFormSection>
	     <wssuc:ButtonSection runat="server" ShowStandardCancelButton="false">
		    <Template_Buttons>
			    <asp:Button runat="server" class="ms-ButtonHeightWidth"
			        OnClick="btnAdd_Click" Text="Add" ValidationGroup="AddProperty" />
		    </Template_Buttons>
	    </wssuc:ButtonSection>
    </table>

    <t:DelegateDataSource ID="dsProperties" runat="server"
        AutoSort="true"
        OnSelect="GetProperties"
        OnUpdate="UpdateProperty"
        OnDelete="DeleteProperty" />

    <h3 class="ms-standardheader">Site Properties</h3>
	<sp:SPGridView ID="gvProperties" runat="server" width="100%" DataSourceId="dsProperties" AutoGenerateColumns="false" DataKeyNames="Key" AllowSorting="true">
		<AlternatingRowStyle CssClass="ms-alternating" />
		<Columns>
			<asp:BoundField HeaderText="Key" DataField="Key" SortExpression="Key" ReadOnly="true" />
			<asp:TemplateField HeaderText="Value">
			    <ItemTemplate><%# Server.HtmlEncode(Eval("Value").ToString()) %></ItemTemplate>
			    <EditItemTemplate>
			        <asp:TextBox ID="txtUpdateValue" runat="server" CssClass="ms-long"
			            Text='<%# Bind("Value") %>' />
			        <asp:LinkButton runat="server" CommandName="Update" Text="Update" />
			        <asp:LinkButton runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
			        <sp:InputFormRequiredFieldValidator runat="server"
				        ControlToValidate="txtUpdateValue"
					    ErrorMessage="Value is required" />
			    </EditItemTemplate>
			</asp:TemplateField>
			<asp:ButtonField HeaderText="Edit" CommandName="Edit"
			    ButtonType="Image" ImageUrl="/_layouts/images/edit.gif" Text="Edit" />
			<asp:ButtonField HeaderText="Delete" CommandName="Delete"
			    ButtonType="Image" ImageUrl="/_layouts/images/delete.gif" Text="Delete" />
		</Columns>
	</sp:SPGridView>

</asp:Content>